package com.mvp.shq.washer.ui.orderConfirm;

import com.mvp.shq.washer.entity.result.AliPay;
import com.mvp.shq.washer.entity.result.AlipayResult;
import com.mvp.shq.washer.entity.result.BaseResult;
import com.mvp.shq.washer.entity.OrderResponse;
import com.mvp.shq.washer.entity.result.WasherInfoResult;
import com.mvp.shq.washer.entity.result.WxPayResult;
import com.mvp.shq.washer.http.Api;
import com.mvp.shq.washer.http.RxSchedulers;

import io.reactivex.Observable;

/**
 * Created by Administrator on 2017/8/28.
 */

public class Model implements OrderConfirmConstract.Model {
    @Override
    public Observable<BaseResult<String>> getSign(String token, String orderNo) {
        return Api.getInstance().service
                .getSign(token,orderNo).compose(RxSchedulers.io_main());
    }

    @Override
    public Observable<BaseResult<AliPay>> alipayPay(String token, OrderResponse orderDto) {
        return Api.getInstance().service
                .alipayOrder(token,orderDto)
                .compose(RxSchedulers.io_main());
    }

    @Override
    public Observable<BaseResult<WxPayResult>> wxPay(String token, OrderResponse orderDto) {
        return Api.getInstance().service
                .wxOrder(token,orderDto)
                .compose(RxSchedulers.io_main());
    }
    @Override
    public Observable<BaseResult<WasherInfoResult>> getWasherInfo(String token, String washerNo) {
        return Api.getInstance().service
                .washerInfo(token,washerNo)
                .compose(RxSchedulers.io_main());
    }
}
